#include <iostream>
#include <string>

using namespace std;

// 复数类
class Complex
{
private:
    double real; // 实部
    double imag; // 虚部

public:
    // 构造
    Complex()
        : real(0), imag(0)
    {
    }
    Complex(double real, double imag)
        : real(real), imag(imag)
    {
    }
    // 析构
    ~Complex() {}

public:
    // 显示
    void Show()
    {
        cout << "实部" << real << "虚部" << imag << endl;
    }

public:
    // 运算符重载结果 = L.operator#( R )eW   L + R
    const Complex operator+(Complex R) const
    {
        Complex x;
        x.imag = this->imag + R.imag;
        x.real = this->real + R.real;
        return x;
    }

    const Complex operator-(Complex R) const
    {
        Complex x;
        x.imag = this->imag - R.imag;
        x.real = this->real - R.real;
        return x;
    }


    friend const Complex operator*(Complex L , Complex R);
};

const Complex operator*(Complex L , Complex R)
{
    Complex x;
    x.imag = L.imag * R.imag;
    x.real = L.real * R.real;
    return x;
}

int main(int argc, char const *argv[])
{
    Complex F1(10, 30);
    Complex F2(10, 30);
    Complex F3(10, 30);
    
    // 加法 
    F3 = F1 + F2;
    F3.Show();

    // 加法 
    F3 = F1 * F2;
    F3.Show();

    return 0;
}
